package com.apes.autoparts.supplier.dataCenter;

import com.apes.autoparts.supplier.platform.SupplierPlatformItem;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * Created by lishikun on 2021/5/19 14:15
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = DCBusinessinfo.CONST_TABLE_NAME)
public class DCBusinessinfo extends Model {
    public static final String CONST_TABLE_NAME = "dc_businessinfo";
    @Id
    @Comment("流水码")
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "数据中心供应商表")
    private String id;

    @Comment("供应商")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "supplier_platform_item_id", referencedColumnName = "id")
    private SupplierPlatformItem supplierPlatformItem;

    @Comment("商家编码")
    @Column(name = "BUSINESS_ID")
    private String BUSINESS_ID;

    @Comment("品牌名称")
    @Column(name = "BRAND_NAME")
    private String BRAND_NAME;

    @Comment("品牌件型号")
    @Column(name = "BRAND_MODEL")
    private String BRAND_MODEL;

    @Comment("零件名称")
    @Column(name = "PART_NAME")
    private String PART_NAME;

    @Comment("计量单位")
    @Column(name = "UOM_NAME")
    private String UOM_NAME;

    @Comment("通用件号")
    @Column(name = "UNIVERSAL_PART_NUMBER")
    private String UNIVERSAL_PART_NUMBER;

    @Comment("产品描述")
    @Column(name = "PRODUCT_DESCRIPTION")
    private String PRODUCT_DESCRIPTION;

    @Comment("库存数量")
    @Column(name = "INVENTORY_QUANTITY", columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    private double INVENTORY_QUANTITY;

    @Comment("不含税价")
    @Column(name = "UNTAX_PRICE", columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    private double UNTAX_PRICE;

    @Comment("上下架")
    @Column(name = "ONSHELVES")
    private String ONSHELVES;

    @Comment("尺寸")
    @Column(name = "SIZES")
    private String SIZES;


    @Comment("产地")
    @Column(name = "ORIGIN")
    private String ORIGIN;


    @Comment("供应商编码")
    @Column(name = "SUPPLIER_ID")
    private String SUPPLIER_ID;


    @Comment("供应商名称")
    @Column(name = "SUPPLIER_NAME")
    private String SUPPLIER_NAME;

    @Comment("录入人")
    @Column(name = "LRR")
    private String LRR;

    @Comment("录入日期")
    @Column(name = "LRRQ_SJ")
    private String LRRQ_SJ;

    @Comment("商家数据信息编码")
    @Column(name = "DCID")
    private String DCID;

    @Comment("时间戳")
    @Column(name = "TS01")
    private String TS01;


    @Comment("品质名称")
    @Column(name = "QUALITY_NAME")
    private String QUALITY_NAME;

    @Comment("包装含量")
    @Column(name = "BZHL")
    private String BZHL;

    @OneToOne(mappedBy = "DCBusinessinfo", cascade = CascadeType.ALL, orphanRemoval = true)
    private DCBusinessinfoContrast dcBusinessinfoContrast;
}
